package com.sizu.service.impl;

import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.baomidou.mybatisplus.mapper.Wrapper;
import com.sizu.entity.TCustomerStatement;
import com.sizu.mapper.TCustomerStatementMapper;
import com.sizu.service.ITCustomerStatementService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 赵玉玺
 * @since 2020-03-16
 */
@Service
public class TCustomerStatementServiceImpl extends ServiceImpl<TCustomerStatementMapper, TCustomerStatement> implements ITCustomerStatementService {

    @Override
    public boolean upTCustomerStatementState(String number) {
        Wrapper<TCustomerStatement> tCustomerStatementWrapper=new EntityWrapper<>();
        tCustomerStatementWrapper.eq("customer_number",number);
        TCustomerStatement tCustomerStatement=new TCustomerStatement();
        tCustomerStatement.setState(2);
        this.baseMapper.update(tCustomerStatement,tCustomerStatementWrapper);
        return true;
    }

    @Override
    public List<TCustomerStatement> getTCustomerStatement() {
        Wrapper<TCustomerStatement> tCustomerStatementWrapper=new EntityWrapper<>();
        tCustomerStatementWrapper.eq("state","1");
        List<TCustomerStatement> tCustomerStatements = this.baseMapper.selectList(tCustomerStatementWrapper);
        return tCustomerStatements;
    }
}
